package com.shuda.business.user.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.shuda.common.core.domain.BaseEntity;

/**
 * 用户实体类：补充显式访问器与兼容方法，确保Service层编译通过。
 */
@TableName("sys_user")
public class UserEntity extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** 用户ID */
    private Long id;

    /** 用户名 */
    private String username;

    /** 密码 */
    private String password;

    /** 昵称 */
    private String nickname;

    /** 真实姓名 */
    private String realName;

    /** 手机号 */
    private String phone;

    /** 邮箱 */
    private String email;

    /** 状态（active/disabled） */
    private String status;

    /** 部门ID */
    private Long deptId;

    /** 角色ID */
    private Long roleId;

    /** 头像 */
    private String avatar;

    /** 备注 */
    private String remark;

    /** 租户ID */
    private Long tenantId;

    /**
     * id访问器
     */
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }

    public String getUsername() { return username; }
    public void setUsername(String username) { this.username = username; }

    public String getPassword() { return password; }
    public void setPassword(String password) { this.password = password; }

    public String getNickname() { return nickname; }
    public void setNickname(String nickname) { this.nickname = nickname; }

    public String getRealName() { return realName; }
    public void setRealName(String realName) { this.realName = realName; }

    public String getPhone() { return phone; }
    public void setPhone(String phone) { this.phone = phone; }

    public String getEmail() { return email; }
    public void setEmail(String email) { this.email = email; }

    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }

    public String getAvatar() { return avatar; }
    public void setAvatar(String avatar) { this.avatar = avatar; }

    public String getRemark() { return remark; }
    public void setRemark(String remark) { this.remark = remark; }

    public Long getTenantId() { return tenantId; }
    public void setTenantId(Long tenantId) { this.tenantId = tenantId; }

    /**
     * 兼容Service层使用的审计字段命名（createTime/createBy/updateTime/updateBy/deleted）。
     * 映射到父类BaseEntity中的createdTime/creator/updatedTime/updater/delFlag。
     */
    public void setCreateTime(java.time.LocalDateTime createTime) { super.setCreatedTime(createTime); }
    public java.time.LocalDateTime getCreateTime() { return super.getCreatedTime(); }

    public void setCreateBy(java.lang.Long createBy) { super.setCreator(createBy); }
    public java.lang.Long getCreateBy() { return super.getCreator(); }

    public void setUpdateTime(java.time.LocalDateTime updateTime) { super.setUpdatedTime(updateTime); }
    public java.time.LocalDateTime getUpdateTime() { return super.getUpdatedTime(); }

    public void setUpdateBy(java.lang.Long updateBy) { super.setUpdater(updateBy); }
    public java.lang.Long getUpdateBy() { return super.getUpdater(); }

    public void setDeleted(int deleted) { super.setDelFlag(String.valueOf(deleted)); }
    public int getDeleted() { try { return Integer.parseInt(super.getDelFlag()); } catch (Exception e) { return 0; } }
}